qui(
    function (require, exports, module) {

        Ticket.LiveEdit = function (options) {
            this.dao = Ticket.Dao;
            this.config = Ticket.Config;
            this.util = Ticket.Util;
            this.options = options || {};
        };

        Com.inherits(Ticket.LiveEdit, function (options) {
        }).extend({
            doInit: function () {
                var self = this;
                var taskArr = [];
                taskArr.push(self.task.getConfigType(self.dao.cfgName.logType));
                taskArr.push(self.task.getConfigType(self.dao.cfgName.workType));
                $.each(taskArr, function (index, element) {
                    EpgWeb.ajaxQueue.push(element.regName, element.options);
                })
                EpgWeb.ajaxQueue.afterLoadComplete(function () {
                    self.startLiveEdit();
                })
                EpgWeb.ajaxQueue.startLoad();
            },
            startLiveEdit:function(){
                var self = this;
                self.initEvent();
                self.initDlgAll();
                Ticket.Util.bindFoldDiv();
                var dataId = Com.url.getParameter("dataId");
                if (!EpgWeb.Plugin.Validate.checkNum(dataId)) {
                    EpgWeb.Plugin.showTips({content: "参数错误", type: "error"})
                    return;
                }
                self.dao.cfgName.entityId = dataId;
                self.dao.getTicketDataList({params: JSON.stringify({EQL_id: dataId})}, function (rdata) {
                    if (rdata != null && rdata.code == Ticket.Config.CODE_SUC) {
                        var entity = rdata.data.result[0];
                        if (entity != null) {
                            self.initDetail(entity);
                        }
                    }
                })
            },

            initEvent: function () {
                $("button[name=btn_checkList]").bind("click", function (event) {
                    Ticket.Util.openDlgCheckList();
                })
            },
            initDlgAll: function () {
                var self = this;
                self.initDlgCheckList();
                $(".ui-dialog-titlebar-close").html('<span class="ui-button-icon-primary ui-icon ui-icon-closethick"></span><span class="ui-button-text">close</span>');
            },
            initDetail: function (entity) {
                $("input[name=hidden_entityId]").val(entity.id);
                Ticket.Model.decodeLiveDetail(entity.detail )
            },
            initDlgCheckList: function () {
                $("#dlg_checkList").dialog({
                    title: "直播检查列表",
                    autoOpen: false,
                    width: 500,
                    modal: true,
                    dialogClass: 'alert',
                    resizable: false,
                    open: function () {
                        $("#form_checkList")[0].reset();
                        $("#form_checkList").find("a.qui-tag-remove").click();
                        $("#form_checkList").find("input[name=project_workers]").suggest("setValue", "");
                    }
                });
            }
        });

    }
);